package com.gmadmin.controller;


import com.gmadmin.common.ApiResponse;
import com.gmadmin.service.SysDictService;
import com.gmadmin.entity.vo.dict.SysDictVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhangliang
 * @version 1.0
 * @date 2022/6/8 12:47
 */
@Api(tags = "系统:字典管理")
@RestController
@RequestMapping("/api/system/dict")
public class SysDictController {


    private final SysDictService dictService;

    public SysDictController(SysDictService dictService) {
        this.dictService = dictService;
    }

    @ApiOperation(value = "根据字典名称集合批量获取字典", httpMethod = "GET")
    @ApiParam(name = "dictNames", value = "字典名称集合", required = true)
    @GetMapping("dictNames")
    public ApiResponse<List<SysDictVo>> getDictByNames(@RequestParam List<String> dictNames) {
        return ApiResponse.ofSuccess(dictService.getDictByNames(dictNames));
    }
}
